#pragma once
#include <windows.h>
enum eType{HERO, UNIT, STRUCTURE, RESOURCE, TYPE};
class CBase
{
	unsigned int m_uiRefCount;
	float m_fPosX;
	float m_fPosY;
	float m_fVelX;
	float m_fVelY;
	float m_fPower;
	float m_fRange;
	float m_fSpeed;
	int m_nMaxHP;
	int m_nCurrHP;
	int m_nCost;
	int m_nWidth;
	int m_nHeight;

protected:
	int m_nType;

public:

	//Accessors
	int GetType() {return m_nType;}
	float GetPosX() {return m_fPosX;}
	float GetPosY() {return m_fPosY;}
	float GetVelX() {return m_fVelX;}
	float GetVelY() {return m_fVelY;}
	float GetPower() {return m_fPower;}
	float GetRange() {return m_fRange;}
	float GetSpeed() {return m_fSpeed;}
	int GetMaxHP() {return m_nMaxHP;}
	int GetCurrHP() {return m_nCurrHP;}
	int GetCost() {return m_nCost;}
	int GetWidth() {return m_nWidth;}
	int GetHeight() {return m_nHeight;}

	//Mutators
	void SetPosX(float X) {m_fPosX = X;}
	void SetPosY(float Y) {m_fPosY = Y;}
	void SetType(int Type) {m_nType = Type;}
	void SetVelX(float VelX) {m_fVelX = VelX;}
	void SetVelY(float VelY) {m_fVelY = VelY;}
	void SetPower(float Power) {m_fPower = Power;}
	void SetRange(float Range) {m_fRange = Range;}
	void SetMaxHP(int Max) {m_nMaxHP = Max;}
	void SetCurrHP(int Curr) {m_nCurrHP = Curr;}
	void SetCost(int Cost) {m_nCost = Cost;}
	void SetWidth(int width) {m_nWidth = width;}
	void SetHeight(int height) {m_nHeight = height;}


	CBase();
	virtual ~CBase();

	virtual void Init();
	virtual void Update(float fDelta);
	virtual void Render();
	void AddRef()
	{
		m_uiRefCount++;
	}
	void Release()
	{
		m_uiRefCount--;

		if (m_uiRefCount == 0)
			delete this;
	}
	RECT GetCollisionRect();
	virtual bool Collision(CBase* pBase);
	virtual bool CheckDistance(CBase* pBase, float fDelta);
};